// app.js
import {$http,$get} from './utils/http.js' //ES模块化语法
let fly = require('./utils/request.js') //CommonJS模块化规范
//LeanCloud初始化
const AV = require('./libs/av-core-min.js');
const adapters = require('./libs/leancloud-adapters-weapp.js');
AV.setAdapters(adapters);
AV.init({
    appId: "JLjLPBuvkDdPOdOtWxo5vrTi-gzGzoHsz",
    appKey: "aBO9cNU8LlXNV7T06Wk6egM4",
    serverURL: "https://api2301.h5project.cn"
});
App({
  onLaunch() {
    // 尝试提取本地存储的用户信息
    try {
        var value = wx.getStorageSync('userInfo')
        if (value) {
          // Do something with return value
          this.globalData.userInfo = value
        }
      } catch (e) {
        // Do something when catch error
        console.log('本地存储提取失败');
      }
  },
  globalData: {
    userInfo: null //全局存放用户信息
  },
  $http,
  $get,
  fly
})
